import request from '@/utils/request'

// 查询Manage列表
export function listManage(query) {
  return request({
    url: '/information/manage/list',
    method: 'get',
    params: query
  })
}

// 查询Manage详细
export function getManage(id) {
  return request({
    url: '/information/manage/' + id,
    method: 'get'
  })
}

// 新增Manage
export function addManage(data) {
  return request({
    url: '/information/manage',
    method: 'post',
    data: data
  })
}

// 修改Manage
export function updateManage(data) {
  return request({
    url: '/information/manage',
    method: 'put',
    data: data
  })
}

// 删除Manage
export function delManage(id) {
  return request({
    url: '/information/manage/' + id,
    method: 'delete'
  })
}


// 导入
export function importManage(formData) {
  return request({
    url: '/information/manage/import',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: formData
  })
}

// 下载导入模板
export function downloadTemplate() {
    return request({
        url: '/information/manage/importTemplate',
        method: 'get',
        responseType: 'blob'
    }).then(res => {
        const blob = new Blob([res])
        const url = window.URL.createObjectURL(blob)
        const a = document.createElement('a')
        a.href = url
        a.download = '博士信息导入模板.xlsx'
        a.click()
        URL.revokeObjectURL(url)
    })
}

